package crud.client.event;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;

import crud.client.data.authentication.User;

public class AuthenticatedUserEvent extends GwtEvent<AuthenticatedUserEvent.AuthenticatedUserEventHandler>
{
	private User user;
	

	public AuthenticatedUserEvent(User user)
	{
		super();
		this.user = user;
	}

	// marker for handler logic in registration method
	public interface AuthenticatedUserEventHandler extends EventHandler
	{
		void onAuthenticatedUser(AuthenticatedUserEvent event);
	}

	private static final GwtEvent.Type<AuthenticatedUserEvent.AuthenticatedUserEventHandler> TYPE = new GwtEvent.Type<AuthenticatedUserEventHandler>();

	public static GwtEvent.Type<AuthenticatedUserEventHandler> getType()
	{
		return TYPE;
	}

	@Override
	protected void dispatch(AuthenticatedUserEvent.AuthenticatedUserEventHandler handler)
	{
		handler.onAuthenticatedUser(this);
	}

	@Override
	public GwtEvent.Type<AuthenticatedUserEventHandler> getAssociatedType()
	{
		return TYPE;
	}

	public User getUser()
	{
		return user;
	}



}
